import axios from "axios"
import qs from "qs"
import { App_Key } from "@/configs/key"
function axiosPost(options){
  axios({
      url:options.url,
      method:"POST",
      header:{
          "Content-Type":"application/x-www-form-urlencoded"
      },
      data: qs.stringify({
          ...options.data,
          key: App_Key
      })
  }).then((res) => {
    options.success(res.data)
  }).catch((err) => {
    options.error(err)
  });
}

function axiosGet(options){
   axios(options.url+"&key="+App_Key).then((res) => {
    options.success(res.data)
  }).catch((err) => {
    options.error(err)
  });
}

export {
    axiosPost,axiosGet
}